package com.ycx.ycxmybatismanagement.controller;

import com.ycx.ycxmybatismanagement.aop.LoginLog;
import com.ycx.ycxmybatismanagement.dto.LoginDTO;
import com.ycx.ycxmybatismanagement.pojo.Result;
import com.ycx.ycxmybatismanagement.service.LoginService;
import com.ycx.ycxmybatismanagement.vo.LoginResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.security.auth.login.LoginException;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    @PostMapping("/login")
    @LoginLog
    public Result<LoginResultVo> login(@RequestBody LoginDTO loginDTO) throws LoginException {
        LoginResultVo loginResult = loginService.login(loginDTO);
        return Result.success(loginResult);
    }

}
